package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
@ToString
public class Customer {

    public static final int STATUS_COMMON = 0 ;//潜在客户
    public static final int STATUS_NORMAL = 1 ;//正式客户
    public static final int STATUS_FAIL = 2 ;//开发失败
    public static final int STATUS_LOST = 3 ;//流失客户
    public static final int STATUS_POOL = 4 ;//客户池


    private Long id;

    private String name;

    private Integer age;

    private Integer gender;

    private String tel;

    private String qq;

//    private Long jobId;
    //职业
    private SystemDictionaryItem job;

//    private Long sourceId;
    //来源
    private SystemDictionaryItem source;


//    private Long sellerId;
    //销售员
    private Employee seller;

//    private Long inputuserId;
    //录入员
    private Employee inputUser;

    private Date inputTime;

    private Integer status = STATUS_COMMON;

    public String getStatusName(){
        switch (status){
            case STATUS_COMMON:
                return "潜在客户";
            case STATUS_NORMAL:
                return "正式客户";
            case STATUS_FAIL:
                return "开发失败";
            case STATUS_LOST:
                return "流失客户";
            case STATUS_POOL:
                return "客户池";
            default:
                return "潜在客户";
        }
    }

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",this.id);
        map.put("name",this.name);
        map.put("age",this.age);
        map.put("gender",this.gender);
        map.put("tel",this.tel);
        map.put("qq",this.qq);
        map.put("job",this.job);
        map.put("source",this.source);
        map.put("seller",this.seller);
        map.put("inputUser",this.inputUser);
        map.put("inputTime",this.inputTime);
        map.put("status",this.status);
        return JSON.toJSONString(map);
    }
}